package com.shen.keep.app.db;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.shen.keep.model.Keep;
import com.shen.keep.model.Quote;
import com.shen.keep.model.User;

import com.shen.keep.app.db.KeepDao;
import com.shen.keep.app.db.QuoteDao;
import com.shen.keep.app.db.UserDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig keepDaoConfig;
    private final DaoConfig quoteDaoConfig;
    private final DaoConfig userDaoConfig;

    private final KeepDao keepDao;
    private final QuoteDao quoteDao;
    private final UserDao userDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        keepDaoConfig = daoConfigMap.get(KeepDao.class).clone();
        keepDaoConfig.initIdentityScope(type);

        quoteDaoConfig = daoConfigMap.get(QuoteDao.class).clone();
        quoteDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        keepDao = new KeepDao(keepDaoConfig, this);
        quoteDao = new QuoteDao(quoteDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);

        registerDao(Keep.class, keepDao);
        registerDao(Quote.class, quoteDao);
        registerDao(User.class, userDao);
    }
    
    public void clear() {
        keepDaoConfig.clearIdentityScope();
        quoteDaoConfig.clearIdentityScope();
        userDaoConfig.clearIdentityScope();
    }

    public KeepDao getKeepDao() {
        return keepDao;
    }

    public QuoteDao getQuoteDao() {
        return quoteDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

}
